package cn.wowjoy.pda.android_pharmacy.mvvm.vm.staticH;

import com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter;

import java.util.ArrayList;
import java.util.List;

import cn.bingoogolapple.androidcommon.adapter.BGABindingRecyclerViewAdapter;
import cn.wowjoy.pda.android_pharmacy.R;
import cn.wowjoy.pda.android_pharmacy.common.core.BaseViewModel;
import cn.wowjoy.pda.android_pharmacy.databinding.ItemRvDoorputIndexBinding;
import cn.wowjoy.pda.android_pharmacy.model.xmlEntity.putInfo.PutTotalBeen;

/**
 * Created by Administrator on 2017/8/16.
 */

public class StaticPutIndexViewModel extends BaseViewModel {
    public ArrayList<PutTotalBeen> datas;

    public BGABindingRecyclerViewAdapter<PutTotalBeen, ItemRvDoorputIndexBinding> wlinnerAdapter = new BGABindingRecyclerViewAdapter<>(R.layout.item_rv_staticput_index);
    public LRecyclerViewAdapter adapter = new LRecyclerViewAdapter(wlinnerAdapter);


    public void setData(List<PutTotalBeen> data) {
        if (null == datas)
            datas = new ArrayList<>();
        datas.clear();
        datas.addAll(data);
        wlinnerAdapter.setData(datas);
        adapter.removeFooterView();
        adapter.removeHeaderView();
        adapter.notifyDataSetChanged();
    }
    public void addData(PutTotalBeen data) {
        if (null == datas)
            datas = new ArrayList<>();
        datas.add(data);
        wlinnerAdapter.setData(datas);
        adapter.removeFooterView();
        adapter.removeHeaderView();
        adapter.notifyDataSetChanged();
    }
}
